package de.ludo.gaming;

import de.ludo.dto.GameFieldResponse;
import de.ludo.dto.GameListResponse;
import de.ludo.dto.GameResponse;
import de.ludo.dto.HighscoreResponse;
import de.ludo.dto.PlayerDiceResponse;
import de.ludo.dto.RequestingPlayerListResponse;
import de.ludo.dto.ReturncodeResponse;
import de.ludo.dto.UserLoginResponse;

/**
 * 
 * @author L.Rother
 * 
 */
public interface LudoOnlineIntegration {
	/**
	 * Method to login
	 * 
	 * @param userName
	 * @param pwd
	 * @return UserLoginResponse
	 */
	public UserLoginResponse login(String userName, String pwd);

	/**
	 * Method to register
	 * 
	 * @param userName
	 * @param pwd
	 * @return UserLoginResponse
	 */
	public UserLoginResponse register(String userName, String pwd);

	/**
	 * Method to logout
	 * 
	 * @param sessionId
	 * @return ReturncodeResponse
	 */
	public ReturncodeResponse logout(int sessionId);

	/**
	 * Method to see all free games
	 * 
	 * @param sessionId
	 * @return
	 */
	public GameListResponse getFreeGames();

	/**
	 * Method for visitors to see all running games
	 * 
	 * @return
	 */
	public GameListResponse getRunningGames();

	/**
	 * 
	 * @return GameFieldResponse
	 */
	public GameFieldResponse askForUpdatesOnGameField(int gameId,
			int character1, int character2, int character3, int character4,
			int character5, int character6, int character7, int character8,
			int character9, int character10, int character11, int character12,
			int character13, int character14, int character15, int character16);

	/**
	 * Method to create a new Game Games are saved with used sessionIds
	 * 
	 * @return PlayerGameIdMsgResponse with gameId
	 */
	public GameResponse openNewGame(int sessionId);

	/**
	 * If the available Games are listed, the user can select a game he wants to
	 * enter. This method supplies the Yellow, Red, Green and Blue Player
	 * (always in this order!).
	 * 
	 * @param sessionId
	 * @param gameId
	 * @return
	 */
	public GameResponse enterExistingGame(int sessionId, int gameId);

	public GameResponse allowUserToEnterTheGame(int ownSessionId,
			String userName, int gameId);

	public PlayerDiceResponse dice(int sessionId, int gameId);

	public RequestingPlayerListResponse handleRequests(int sessionId, int gameId);

	public GameFieldResponse startGame(int sessionId, int gameId);

	public ReturncodeResponse closeGame(int gameId);

	public GameFieldResponse moveCharacter(int gameId, int sessionId,
			int gameFieldIndex, int diceResult);

	/**
	 * Is called from requesting Player after he asked for permission to enter
	 * the Game
	 * 
	 * @param sessionId
	 * @param gameId
	 * @return returnCode = 0 if user was accepted, returnCode = 1 if permission
	 *         was denied. If 0, GameTO-Object is delivered
	 */
	public GameResponse isTheRequestingPlayerAccepted(int sessionId, int gameId);

	/**
	 * Is called from player red, blue and green if they were accepted for the
	 * game.
	 * 
	 * @param sessionId
	 * @param gameId
	 * @return returnCode = 0 if the game has started. returnCode = 1 if the
	 *         game is not started yet
	 */
	public GameFieldResponse isTheGameStarted(int sessionId, int gameId);

	/**
	 * Is called from requesting player who does not want to play anymore
	 * 
	 * @param sessionId
	 * @param gameId
	 * @return returnCode = 0 if deleted was successful, 1 if it was not and the
	 *         game has already started (=> if he leaves despite this fact, he
	 *         will get negative points for the game
	 * 
	 */
	public ReturncodeResponse removeRequestingPlayerFromList(int sessionId,
			int gameId);

	/**
	 * Is called from player who wants to leave a running game
	 * 
	 * @param sessionId
	 * @param gameId
	 * @return {@link GameResponse}
	 */
	public ReturncodeResponse leaveRunningGame(int sessionId, int gameId);

	public HighscoreResponse getHighscoreList(String game);

	public GameResponse getGameById(int gameId);

	public ReturncodeResponse leaveOpenGame(int sessionId, int gameId);

}
